


# 贪心没有套路，说白了就是常识性推导加上举反例。

#  455.分发饼干

def main(g,s):
    g.sort()
    s.sort()
    user_g = [0]*len(g)
    user_s = [0]*len(s)
    sum = 0
    for i in range(0,len(g)):
        for j in range(0,len(s)):
            if s[j]<g[i] and user_g[i]==0 and user_s[j]==0:
                sum = sum + 1
                user_g[i] = 1
                user_s[j] = 1
    return sum

if __name__ == "__main__":
    gg = input()
    ss = input()
    g = [int(i) for i in gg.split()]
    s = [int(i) for i in ss.split()]
    sum = main(g,s)
    print(sum)